<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{title}} - 主页</title>

    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css">
    <link rel="stylesheet" href="https://open.wwsg18.com/openres/editormd/css/editormd.css" />

    <style>
        ::-webkit-scrollbar {
            width: 10px;
            height: 10px
        }

        ::-webkit-scrollbar-track {
            box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3) inset;
            background-color: #F2F2F2;
        }

        ::-webkit-scrollbar-thumb {
            box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3) inset;
            background-color: #1AA094;
        }
    </style>
</head>

<body style="background-color: #eeeeee;">
    
    <ul class="layui-nav" lay-filter="">
        <li class="layui-nav-item"><a style="font-size: 18px;">{{title}}</a></li>
        <li class="layui-nav-item layui-this"><a href="/">主页</a></li>
        <!-- <li class="layui-nav-item">
            <a href="javascript:;">工具</a>
            <dl class="layui-nav-child">
                <dd><a href="javascript:;" id="fogpwd">密码找回</a></dd>
            </dl>
        </li> -->
        {{# login}}
        <li class="layui-nav-item" style="float: right;">
            <a href="javascript:;">{{login}}</a>
            <dl class="layui-nav-child">
                <dd><a href="/admin/">后台管理</a></dd>
                <dd><a href="javascript:;" class="login-out">退出登录</a></dd>
            </dl>
        </li>
        {{/ login}}

        {{^ login}}
        <li class="layui-nav-item" style="float: right;"><a href="/admin/">登录后台</a></li>
        {{/ login}}
    </ul><br />

    <div class="layui-container">
        <div class="layui-card">
            <div id="mark-context"></div>
        </div>
        <div class="layui-card" style="width: 103.5%;">
            <br />
            <div id="yiyan" style="text-align: center;">

            </div><br />
        </div>
    </div><br />

    <script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

    <script src="/resource/LyMaster.js"></script>

    <script src="https://open.wwsg18.com/openres/editormd/lib/marked.min.js"></script>
    <script src="https://open.wwsg18.com/openres/editormd/lib/prettify.min.js"></script>
    <script src="https://open.wwsg18.com/openres/editormd/lib/raphael.min.js"></script>
    <script src="https://open.wwsg18.com/openres/editormd/lib/underscore.min.js"></script>
    <script src="https://open.wwsg18.com/openres/editormd/lib/sequence-diagram.min.js"></script>
    <script src="https://open.wwsg18.com/openres/editormd/editormd.min.js"></script>

    <script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>

    <script>
        var master = new LyMaster();

        layui.use(['element', 'layer', 'util'], function () {
            var element = layui.element;
            var layer = layui.layer;
            var util = layui.util;

            $.get('/exaster/api/markdown?which=index&get=markdown', function (res) {
                // $('#mark-context').html(res.data);
                editormd.markdownToHTML("mark-context", {
                    markdown: res.data,
                    emoji: true,
                    taskList: true,
                    tex: true
                });

            });

            util.fixbar({
                bar1: "&#xe609;",
                bar2: "&#xe670;",
                click: function (type) {
                    if (type === 'bar1') {
                        layer.prompt({
                            title: '请输入反馈信息：信息将被发送至管理员账号！',
                            formType: 2
                        }, function (text, index) {
                            layer.close(index);
                            $.get('/exaster/api/feedback?message=' + text, function (res) {
                                if (res.data == 'OK') {
                                    layer.msg("信息反馈成功！");
                                } else if (res.data == 'DISABLED') {
                                    layer.msg("信息反馈功能未开启！");
                                }
                            });
                        });
                    } else if (type === 'bar2') {
                        window.open("http://bbs.wwsg18.com/t/talk");
                    }
                }
            });

            // 一言获取
            $.get('https://v1.hitokoto.cn?c=d&c=i', function (res) {
                $("#yiyan").html("<span title='出处：" + res.from + "'>『 " + res.hitokoto + " 』</span>");
            });


            $('#fogpwd').on("click", function () {
                
            });

            $('.login-out').on("click", function () {
                $.get('{{domain}}/admin/api/user/self?do=outlogin', function (res) {
                    // 退出登录检测
                    if (res.code == '200' && res.data == 'OK') {
                        setTimeout(() => {
                            location.reload();
                        }, 1200);
                    } else {
                        layer.msg('退出登录出现异常...');
                    }
                });
            });

        });
    </script>

</body>

</html>